Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pedantic memory leak in handshake test #4463

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

jmayclin
Copy link
Contributor

@jmayclin jmayclin commented Mar 20, 2024

We run valgrind with "pedantic" settings, which requires that memory in child processes is explicitly freed before the process exits. This is commonly an issue when defer cleanup is used, because defer cleanup statements are not invoked when the "exit" system call is used.

Description of changes:

#4369 merges in CI changes to catch these errors, but s2n_handshake_test was modified in between when I opened the PR and when I tried to merge the PR. After rebasing on main, this is now causing failures for my PR.

This PR fixes the new failures in s2n_handshake_test separately from #4369 to make review easier.

Testing:

failing run for current mainline build with my valgrind changes:here

(Initial draft): passing run of this change with my valgrind changes rebased on top of it: here

(nested scope): here

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

We run valgrind with "pedantic" settings, which requires that memory in
child processes is explicitly freed before the memory goes out of scope.
This is commonly an issue when defer cleanup is used, because defer
cleanup statements are not invoked when the "exit" system call is used.
@github-actions github-actions bot added the s2n-core team label Mar 20, 2024
@jmayclin jmayclin marked this pull request as ready for review March 20, 2024 01:04
- use nested scope rather than explicit frees
@jmayclin jmayclin enabled auto-merge (squash) March 20, 2024 19:12
tests/unit/s2n_handshake_test.c Outdated Show resolved Hide resolved
Co-authored-by: Sam Clark <3758302+goatgoose@users.noreply.github.com>
@jmayclin jmayclin merged commit 8ae6217 into aws:main Mar 20, 2024
31 checks passed
@jmayclin jmayclin deleted the fix-pedantic-leak branch July 1, 2024 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants